package com.midele.goodstuff.ui.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.midele.goodstuff.R

@Composable
fun CommBackArrow(modifier: Modifier = Modifier, title:String,onClick: () -> Unit) {
    Box(
        modifier = modifier.padding(top = 44.dp).height(44.dp).fillMaxWidth()
    ) {
        IconButton(
            onClick = onClick,
            modifier = Modifier
                .align(Alignment.CenterStart)
        ) {
            Image(
                painter = painterResource(id = R.mipmap.ic_white_back_arrow), // 替换为你的图标资源ID
                contentDescription = "Setting Icon", // 图标描述，对于无障碍很重要
                modifier = Modifier
                    .size(24.dp)
            )
        }

        Text(
            text = title,
            color = Color.White,
            fontSize = 17.sp,
            textAlign = TextAlign.Center,
            modifier = Modifier
                .align(Alignment.Center)
        )

    }
}